<extend name="Public/base" />

<block name="style">
<style>
	.page-content{padding:15px 10px;}
	.search_pannl_div .single-col label{width:75px;}
</style>
</block>

<block name="body">
	<!-- 弹窗插件 -->
    <include file="Public:artdialog" />


     <div class="row">
        <div class="col-md-12">
            <div class="block-web">
				<!-- 商品列表 -->
				<form action="{:U('add_promoter_list')}" method="post" onsubmit="return false" id="SearchFrom">
				<input type="hidden" name="packageid" value="{$packageid}" />
				        <div class="bgmain">

                            </div>
				        	<div class="header">
			                    <h3 class="content-header" >添加发起人</h3>
			                </div>
				        
		                    <div class="block-web" style="margin: 0;padding:10px 20px 0px 0px;">
		                        <div class="porlets-content">
		                            <div class="row" style="margin-left:-45px;">
		                                <div class="col-md-12">
		                                    <div class="search_pannl_div">
		                                        <table class="search_table">
		                                            <tbody>
		                                                <tr>
		                                              <td class="single-col">
		                                                        <label>关键词：</label><input style="width:120px;" type="text" id="keywords" name="keywords" placeholder="输入用户名" value="">
		                                                        <button type="button" class="btn btn-success" formtarget="SearchFrom" id="searchBtn" onclick="goSearch('#searchBtn','load_tb_div')"><i class="fa fa-search"></i> 搜索</button>
		                                                        <button type="button" class="btn btn-default" onclick="$('input[type=text]').val(['']);$('select').val('');goSearch('#searchBtn','load_tb_div');"> 查看所有</button>

		                                                         <a href="javascript:;" class="btn btn-sm btn-primary" style="float:right" onclick="set_add_promoter_list()" >确认添加发起人</a>
		                                                    </td>
		                                                </tr>
		                                            </tbody>
		                                        </table>
		                                    </div>
		                                </div>
		                            </div>
		                        </div>
		                    </div>
			    	 </div>
			   
				<div id="load_tb_div" style="padding:10px 0px 30px ;">
				</div>
				<script>
				 	$(function () {
				        _load_html_byurl("{:U('add_promoter_list',array('packageid'=>$packageid))}", "load_tb_div");
				    });
				</script>
              	</form>
            </div><!--/porlets-content-->
              <a href="javascript:;" style="margin:0 0 0 10px" class="btn btn-sm btn-primary" onclick="set_add_promoter_list()" >确认添加发起人</a>
        </div><!--/block-web-->

    </div><!--/col-md-12-->
    
</block>

<block name="script">
<script>
var packageid = "{$packageid}";
 function set_add_promoter_list(){
 	debugger;
  	var cookiename= packageid+"_<?php echo UID; ?>";
  		    var postdata=getCookie(cookiename);
  		    if(num < 0){
  		        art.dialog({title:'温馨提示',content: '该包已经满员呢,已近超出了'+Math.abs(num)+'个包，请正确选择 ！', ok: function () {this.close();return false;},okval:'确定'});
  		    	return;
  		    }
  		    if(postdata==""){
  		    	art.dialog({title:'温馨提示',content: '请选择需要的添加的人员', ok: function () {this.close();return false;},okval:'确定'});
  		    	return;
  		    }
  		         $.ajax({
			         'url': "{:U('set_add_promoter_list')}",
			         'data': {'packageid':packageid,'json':postdata},
			         'dataType': 'json',
			         'type': 'POST',
			         success: function (data) {
			             debugger
			             if(!data){
			                 art.dialog({title:'温馨提示',content: '提交数据保存失败', ok: function () {this.close();return false;},okval:'确定'});
			                 return;
			             }
			            art.dialog({title:'温馨提示',content: data.msg, ok: function () {this.close();return false;},okval:'确定'});
			             
			             if (data.staute =="success") {  
			                 setCookie(cookiename,"",-10); //清理cookie信息
			                 setCookie('num',-10); //清理cookie信息
				            setTimeout(function(){
	                          var win=  art.dialog.opener;
	                                    win._reload_currentpage_datalist('load_tb_div');
	                                    art.dialog.close();
										//window.location.replace("{:U('groupList')}");
	                                   },500);

				             }

			         }, error: function (err) { 
			             debugger
			             art.dialog({title:'温馨提示',content: err.responseText, ok: function () {this.close();return false;},okval:'确定'});
			         },complete: function () {
			            
			         }
			     });  

 }
</script>
</block>

